<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 *订单管理
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$return=array();
$tabs=array(
	array('op'=>'list','title'=>$this->y_title.'列表'),
);
if($_RQ['op']=='list'){
	if($_RQ['id']){
		$this->session('cangid',$_RQ['id']);
	}
	$cangid=$this->session('cangid');
	$return['params']=array();
	$params=array('uniacid'=>$_SESSION['uniacid'],'cangid'=>$cangid);
	if(isset($_RQ['paixu'])){
		$params['paixu']=intval($_RQ['paixu']);
		$return['params']['paixu']=intval($_RQ['paixu']);
	}
	$pindex = max(1, intval($_RQ['page']));
	if($_RQ['psize']){
		$_SESSION['psize']=$_RQ['psize'];
	}
	$psize = $_SESSION['psize']?:10;
	$list=pdo_getslice('jy_mjicai_yao',$params,array($pindex,$psize),$total,$fields,'','id desc');
	if($list){
		foreach($list as $k=>&$v){
			$this->model('model')->up_yao($v);
			$v['isfee']=pdo_getsum('jy_mjicai_canlog',array('yaoid'=>$v['id'],'cangid'=>$this->session('cangid'),'uniacid'=>$_SESSION['uniacid']),'jifen');
			$v['isget']=pdo_getsum('jy_mjicai_feelog',array('type'=>0,'yaoid'=>$v['id'],'cangid'=>$this->session('cangid'),'uniacid'=>$_SESSION['uniacid']),'fee');
			$v['zhiget']=pdo_getsum('jy_mjicai_feelog',array('type'=>5,'yaoid'=>$v['id'],'cangid'=>$this->session('cangid'),'uniacid'=>$_SESSION['uniacid']),'fee');
			$v['jiget']=pdo_getsum('jy_mjicai_feelog',array('type'=>6,'yaoid'=>$v['id'],'cangid'=>$this->session('cangid'),'uniacid'=>$_SESSION['uniacid']),'fee');
		}
	}
	$return['list']=$list;
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	$htmls=array(
		'type'=>'list',
		'tabs'=>$tabs,
		'list'=>array('data'=>'list','total'=>$total,'psize'=>$psize,'edit'=>false,'del_one'=>false,'delall'=>false,'list'=>array(
			array('name'=>'paixu','title'=>'第几'.$this->y_title,'type'=>'unitstring','unit'=>$this->y_title),
			array('name'=>'alljifee','title'=>'满额积分','type'=>'string'),
			array('name'=>'isfee','title'=>'已投入积分','type'=>'string'),
			array('name'=>'isget','title'=>'投入积分收益','type'=>'string'),
			array('name'=>'zhiget','title'=>'直推积分收益','type'=>'string'),
			array('name'=>'jiget','title'=>'级差积分收益','type'=>'string'),
			array('name'=>'status','title'=>'状态','type'=>'radio','options'=>'yao_status'),
			array('name'=>'startime','title'=>'开始时间','type'=>'time'),
			array('name'=>'endtime','title'=>'结束时间','type'=>'time'),
		)),
		'search'=>array(
			array('name'=>'paixu','width'=>15,'title'=>'第几'.$this->y_title,'type'=>'string'),
		),
	);
	$return['types']=$this->feelog_type;
	$return['yao_status']=$this->yao_status;
	$return['htmls']=$htmls;	
	exi($return);
}